package com.example.siyun.service.impl.userserverimp;

import com.example.siyun.mapper.usermapper.UserDeveMapper;
import com.example.siyun.pojo.UserList;
import com.example.siyun.service.userserver.UserDeveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.text.ParseException;
import java.util.List;

@Service
public class UserDeveServerImp implements UserDeveService {

    @Autowired
    private UserDeveMapper userDeveMapper;


    /**
     * 全查用户
     * @param userAccount
     * @param userNickname
     * @param createDate
     * @param idCard
     * @param phone
     * @param userEmail
     * @param profession
     * @return
     */
    @Override
    @Transactional
    public List<UserList> getAll(String userAccount, String userNickname, String createDate, String idCard, String phone, String userEmail, String profession) {
        return userDeveMapper.getAll(userAccount,userNickname,createDate,idCard,phone,userEmail,profession);
    }

    /**
     * 编辑用户
     * @param userList
     */
    @Override
    @Transactional
    public void edit(UserList userList) {
        userDeveMapper.edit(userList);
    }

    /**
     * 封禁Switch
     * @param userId
     * @param statuss
     */
    @Override
    @Transactional
    public void upStatuss(int userId, String statuss) {
        userDeveMapper.upStatuss(userId,statuss);
    }

    /**
     * 是否为进思用户查询
     * @param isd
     * @param userAccount
     * @param userNickname
     * @param createDate
     * @param idCard
     * @param phone
     * @param userEmail
     * @param profession
     * @return
     */
    @Override
    @Transactional
    public List<UserList> getUser(int isd,String userAccount, String userNickname, String createDate, String idCard, String phone, String userEmail, String profession) {
        return userDeveMapper.getUser(isd,userAccount,userNickname,createDate,idCard,phone,userEmail,profession);
    }


    /**
     * 查询封号用户
     * @param statuss
     * @param userAccount
     * @param userNickname
     * @param createDate
     * @return
     */
    @Override
    @Transactional
    public List<UserList> getAtu(int statuss,String userAccount, String userNickname, String createDate) {
        return userDeveMapper.getAtu(statuss,userAccount,userNickname,createDate);
    }

    /**
     * 查询零消费用户
     * @param userAmountu
     * @param userAccount
     * @param userNickname
     * @param createDate
     * @return
     */
    @Override
    @Transactional
    public List<UserList> getZero(String userAmountu, String userAccount, String userNickname, String createDate) {
        return userDeveMapper.getZero(userAmountu,userAccount,userNickname,createDate);
    }

    /**
     * 高级检索查询
     * @param user
     * @return
     */
    @Override
    @Transactional
    public void seniorCat(UserList user) {
        userDeveMapper.seniorCat(user);
    }

    /**
     * 修改用户（进思/非进思）
     * @param userId
     * @return
     */
    @Override
    @Transactional
    public void updateIsd(String userId, int isd) {
        userDeveMapper.updateIsd(userId , isd);
    }

    /**
     * 封号日志查询
     * @param cdate
     * @return
     */
    @Override
    @Transactional
    public List<UserList> getClo(Integer cdate) {
        return userDeveMapper.getClo(cdate);
    }

    /**
     * 封号结束时间
     * @param userList
     * @return
     * @throws ParseException
     */
    @Override
    @Transactional
    public void indate(UserList userList) {
        userDeveMapper.indate(userList);
    }

    /**
     * 优惠券和用户两表联查
     * @return
     */
    @Override
    @Transactional
    public List<UserList> getCoupons() {
        return userDeveMapper.getCoupons();
    }

    /**
     * 定时器调用
     * 定时修改封号时间
     */
    @Override
    @Transactional
    public void ind() {
        userDeveMapper.ind();
    }

    /**
     * 封号switch
     * @param userId
     * @param cdate
     * @return
     */
    @Override
    @Transactional
    public void cdate(int userId, Integer cdate) {
        userDeveMapper.cdate(userId,cdate);
    }

    /**
     * 添加封禁原因
     * @param userList
     */
    @Override
    @Transactional
    public void banned(UserList userList) {
        userDeveMapper.banned(userList);
    }


}
